<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('单据查询列表')"/>
    <th:block th:include="include :: list-css"/>


	<!-- 打印控件 -->
	<script src="/js/printWorld/PrintWorld.js"></script>
</head>
<body class="no-skin">
<script th:inline="javascript">
    /*<![CDATA[*/
    var gridColumns = [[${gridColumns}]],
        importFields = [[${importFields}]],
        business = [[${finance}]],
        businessName = gridColumns.moduleAlias,
        moduleTable = [[${moduleTable}]],
        buttonState = [[${buttonState}]],
        passwordAuthentication = [[${passwordAuthentication}]],
        session = [[${session}]];
    console.log("buttonState",buttonState["tp-save"])
    /*]]>*/
    var tableUrl, openRowUrl, exportUrl;
    var prefix = "/finance/" + business;
    switch (business) {
        case 'customer':
        case 'provider':
            tableUrl = "/crm/" + business + "/list?deleted=0";
            break;
        default:
            tableUrl = "/finance/" + business + "/list";
            openRowUrl = "/finance/" + (business.split('/')[1] ? business.split('/')[0] : business) + "/edit?nid=";
            exportUrl = "/finance/" + business + "/export";
            break;
    }
</script>
<!-- 表格操作区 -->
<script type="text/html" id="barDh">
    <a th:if="${type} =='company'" shiro:hasPermission="finance:accountcountforcompany:edit" class="layui-btn layui-btn-danger layui-btn-xs dhicon dh-edit"
       onclick="editbtn('{{d.guid}}','{{d.vGsBm}}','{{d.vGsMc}}','{{d.fFzEd}}','{{d.vZhLx}}')">&nbsp;修改</a>
    <a th:if="${type} =='company'" class="layui-btn layui-btn-danger layui-btn-xs dhicon dh-edit"
       onclick="details('{{d.vGsBm}}')">&nbsp;冻结资金明细</a>
    <a th:if="${type} =='user'"  shiro:hasPermission="finance:accountcountforuser:edit" class="layui-btn layui-btn-danger layui-btn-xs dhicon dh-edit"
       onclick="editbtn('{{d.guid}}','{{d.userId}}','{{d.userName}}','{{d.fFzEd}}')">&nbsp;修改</a>
</script>

<script type="text/html" id="company">
    <div class="layui-form layuiadmin-card-header-auto tccon" lay-filter="from-val">
        <div class="layui-form-item margin_t0">
            <div class="layui-inline margin_r0 layui-col-xs12">
                <label class="layui-form-label"><font>运营公司编码：</font></label>
                <div class="layui-input-block"><input name="companyId" id="companyId" class="layui-input canntEdit"
                                                      autocomplete="off" readonly/></div>
            </div>
            <div class="layui-inline margin_r0 layui-col-xs12">
                <label class="layui-form-label"><font>运营公司名称：</font></label>
                <div class="layui-input-block"><input name="companyName" id="companyName" class="layui-input canntEdit"
                                                      autocomplete="off" readonly/></div>
            </div>
            <div class="layui-inline margin_r0 layui-col-xs12">
                <label class="layui-form-label"><font>账户类型：</font></label>
                <div class="layui-input-block">
                    <select id="vZhLx" name="vZhLx" lay-verify="required" lay-filter="vZhLx">
                        <option value=""></option>
                        <option value="公司账户">公司账户</option>
                        <option value="运营账户">运营账户</option>
                        <option value="过渡账户">过渡账户</option>
                        <option value="直营账户">直营账户</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline margin_r0 layui-col-xs12">
                <label class="layui-form-label"><font>负债额度：</font></label>
                <div class="layui-input-block"><input type="number" name="companyFzed" id="companyFzed"
                                                      class="layui-input" autocomplete="off"/></div>
            </div>

        </div>
    </div>
</script>
<script type="text/html" id="user">
    <div class="layui-form  layuiadmin-card-header-auto tccon">
        <div class="layui-form-item margin_t0">
            <div class="layui-inline margin_r0 layui-col-xs12">
                <label class="layui-form-label"><font>工号：</font></label>
                <div class="layui-input-block"><input name="userId" id="userId" class="layui-input canntEdit"
                                                      autocomplete="off" readonly/></div>
            </div>
            <div class="layui-inline margin_r0 layui-col-xs12">
                <label class="layui-form-label"><font>姓名：</font></label>
                <div class="layui-input-block"><input name="userName" id="userName" class="layui-input canntEdit"
                                                      autocomplete="off" readonly/></div>
            </div>
            <div class="layui-inline margin_r0 layui-col-xs12">
                <label class="layui-form-label"><font>负债额度：</font></label>
                <div class="layui-input-block"><input type="number" name="userFzed" id="userFzed" class="layui-input"
                                                      autocomplete="off"/></div>
            </div>
        </div>
    </div>
</script>
<th:block th:include="listinclude :: container"/>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: businessJS"/>
<th:block th:include="include :: tableBtn"/>
<th:block th:include="include :: searchJS"/>
<th:block th:include="include :: listJS"/>
<th:block th:include="listinclude :: list-templeat"/>
<script th:inline="javascript">
    /*<![CDATA[*/
    var type = [[${type}]];
    var edit = buttonState["tp-save"];
    console.log("edit",edit)
    /*]]>*/
</script>
<script type="text/javascript">
    var $, layer, laydate, form, table, wherestr = {};
    console.log("mod", moduleTable)
    layui.use(['table', 'laydate', 'form', 'layer', 'jquery', 'element'], function () {

        window.editbtn = function (guid, id, name, fzed,vZhLx) {
            console.log("item", guid, id, name, fzed,vZhLx)
            layer.open({
                type: 1,
                content: $('#' + type).html(),
                area: ['500px', '300px'],
                maxmin: true,
                shade: 0.2,
                title: '负债额度',
                shadeClose: true,
                btn: ['确定', '关闭'],
                success: function (layero, index) {
                    $('#' + type + 'Id').val(id)
                    $('#' + type + 'Name').val(name)
                    $('#' + type + 'Fzed').val(fzed)
                    // $('#vZhLx').val(vZhLx)
                    form.val('from-val', {
                        "vZhLx": vZhLx
                    });
                },
                yes: function (index, layero) {
                    var data = {
                        guid: guid,
                        fFzEd: $('#' + type + 'Fzed').val(),
                        vZhLx: $('#vZhLx').val()
                    }
                    console.log("data",data)
                    $.post("/finance/accountcountfor" + type + "/updateType", {'infoItem': JSON.stringify(data)}, function (res) {
                        layer.msg(res.msg)
                        if (res.code == 0) {
                            location.reload();
                        }
                    });
                }
            });
            form.render();
            form.on('select', function (data) {
                $('#vZhLx').val(data.value)
            });


        }
        window.details = function (vGsbm) {
            layer.open({
                type: 2,
                area: [($(window).width() - 400)+'px', ($(window).height() - 200)+'px'],
                fix: false,//不固定
                offset: '10%',//距离顶部
                maxmin: true,//最大最小化
                shade: 0.3,//遮罩
                title: '冻结资金明细',
                content: '/finance/accountcountforcompany/countForCompany?vGsbm='+vGsbm,
                // btn: ['保存', '取消'],
                shadeClose: true,// 弹层外区域关闭
                success: function(layero, index){

                },

            });
        }
    })

</script>
</body>
</html>
